/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.view.main.header;

import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JToolBar;
import org.jfonia.actions.ActionFactory;
import org.jfonia.view.components.UnifiedToolbarButtonUI;

/**
 *
 * @author Rik Bauwens
 */
public class ToolBar extends JToolBar
{
        public ToolBar()
        {
                super(JToolBar.HORIZONTAL);
                setFloatable(false);
                setOpaque(false);
                //setBackground(Color.WHITE);
                putClientProperty("JToolBar.isRollover",Boolean.TRUE);
                init();
        }

        private void init()
        {
                ActionFactory actionFactory = ActionFactory.getInstance();
                add(createButton(actionFactory.getAction(ActionFactory.NEWACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.OPENACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.SAVEACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.SAVEASACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.UNDOACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.REDOACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.COPYACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.PASTEACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.CUTACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.NEWPARTACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.TAPPINGACTION)));
                //add(createButton(actionFactory.getAction(ActionFactory.NOTATIONMODEACTION)));
                //add(createButton(actionFactory.getAction(ActionFactory.PERFORMANCEMODEACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.PLAYORPAUSEACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.STOPACTION)));
                addSeparator();
                add(createButton(actionFactory.getAction(ActionFactory.RESOURCESACTION)));
                add(createButton(actionFactory.getAction(ActionFactory.HELPACTION)));
        }

        private JButton createButton(AbstractAction action)
        {
                JButton button = new JButton(action);
                button.setOpaque(false);
                button.setUI(new UnifiedToolbarButtonUI());
                return button;
        }
}
